$(document).ready(function () {
    qsxx.onload();
})
var qsxx = (function () {
	var init = function () {
    	layui.use('form', function(){
			  var form = layui.form
		});
    }
    return {
        onload : function () {
        	init();
            qsxx.tableDataQs();
            qsxx.dateShow();
        },
       /*表格数据交互*/
      tableDataQs: function() {//欠税信息表格
 		var data = [{
 				"number": "1",
 				"operation":null,
 				"jkqx": "2018-09-15",
 				"zt":"未到期应缴",
 				"se":"320,222.00",
 				"znj":"0.00",
 				"lx":"0.00",
 				"yjse":"200.00",
 				"yzpzzl":"增值税纳税申报表（小规模纳税人）",
 			
 			},
 			{
 				"number": "2",
 				"operation":null,
 				"jkqx": "2018-09-15",
 				"zt":"未到期应缴",
 				"se":"1,000.00",
 				"znj":"100.00",
 				"lx":"5.00",
 				"yjse":"0.00",
 				"yzpzzl":"房产税汇总申报",
 			
 			}
 			
 		];
 		$('#wepQsxx').DataTable({
 			"data": data,
 			"columnDefs": [
 				{
 					"targets": 1,
 					"data": null,
 					"render": function(data, type, full, meta) {
 						return '<a href="#"><span class="btn wxl_bg_lan1">缴款</span></a>'
 					}
 				}
 			],
 			"columns": [
 			    {
 					"data": "number"
 				},
 				{
 					"data": "operation"
 				},
 				{
 					"data": "jkqx"
 				},
 				{
 					"data": "zt"
 				},
 				{
 					"data": "se"
 				},
 				{
 					"data": "znj"
 				},
 				{
 					"data": "lx"
 				},
 				{
 					"data": "yjse"
 				},
 				{
 					"data": "yzpzzl"
 				}
 			],
// 			"paging": false,
 			"info": false,
 			"ordering": false,
 			"lengthChange": false,
 			"searching": false
 		});
     },
    
     /*日期显示*/
        dateShow:function(){
        	layui.use('laydate', function(){
			  var laydate = layui.laydate;
			  function dateObj(dom1,dom2){//结束时间不小于开始时间
					var startDate   = laydate.render({
						elem: dom1,
						done:function(value,date){
							if( value !== '' ){
								endDate.config.min.year = date.year;
								endDate.config.min.month = date.month - 1;
								endDate.config.min.date = date.date;
							}else{
								endDate.config.min.year = '';
								endDate.config.min.month = '';
								endDate.config.min.date = '';
							}
						}
					});
					var endDate  = laydate.render({
						elem: dom2,
						done:function(value,date){
							if( value !== '' ){
								startDate.config.max.year = date.year;
								startDate.config.max.month = date.month - 1;
								startDate.config.max.date = date.date;
							}else{
								startDate.config.max.year = '';
								startDate.config.max.month = '';
								startDate.config.max.date = '';
							}
						}
					});
				}
				dateObj('#wep_date1','#wep_date2');
			})
        }
    }
})();